package com.example.discover

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.ui.unit.ExperimentalUnitApi
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import androidx.navigation.navigation
import com.example.discover.view.DiscoverListView
import com.example.discover.view.DiscoverSearchView
import com.example.featuresdk.core.AbstractFeatureSDK
import com.example.featuresdk.viewmodel.NavigationViewModel


@OptIn(ExperimentalUnitApi::class)
@ExperimentalFoundationApi
fun NavGraphBuilder.discoverNestedNavigationGraph(screenConfigurationViewModel: NavigationViewModel,
                                                  featureSDK: AbstractFeatureSDK) {

    val featureKey = featureSDK.featureKey()

    navigation(startDestination = "${featureKey}/list", route = "$featureKey") {

        composable("${featureKey}/list") {
            DiscoverListView(screenConfigurationViewModel, featureSDK)
        }

        composable("${featureKey}/search") {
            DiscoverSearchView(screenConfigurationViewModel, featureSDK)
        }
    }
}